<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center kefu_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub kefu_fd0_0'>
					<view class='flex flex-wrap align-center kefu_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  kefu_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='kefu_fd0_0_c1_c0'>在线客服</text>
					</view>
					<view class='flex flex-wrap align-center justify-end kefu_fd0_0_c0'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#988AFB"></u-loading>
				<view>加载中</view>
			</view>
			<block v-else>
				<!---flex布局flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center justify-center benben-flex-layout kefu_flex_1">
					<image class='kefu_fd1_0' mode="aspectFit" :src='info.web_site_bgimg'></image>
					<view class='flex flex-wrap align-center'>
						<text class='kefu_fd1_1_c0'>扫描二维码添加客服微信</text>
					</view>
				</view>

				<!---flex布局flex布局结束-->
				<!---flex布局flex布局开始-->
				<view class="flex benben-flex-layout flex-wrap align-center">
					<view class='flex flex-wrap align-center justify-center kefu_fd2_0' @tap.stop="saveImg">
						<text class='kefu_fd2_0_c0'>保存至相册</text>
					</view>
				</view>

				<!---flex布局flex布局结束-->
			</block>

		</view>
	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"info": {},
				"isShow": true,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getCustomer();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			getCustomer() {
				this.$api.post(global.apiUrls.post6573d60ee49da, {

				}).then(res => {
					this.isShow = false;
					if (res.data.code == 1) {
						this.info = res.data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			saveImg() {
				// #ifdef APP-PLUS
				let _this = this;
				uni.showModal({
					title: '提示',
					content: '访问您的存储权限，使用保存图片到相册功能，用于联系客服，是否允许？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.downloadFile({
								url: _this.info.web_site_bgimg, // 替换为你的图片URL  
								success: function(res) {
									// 下载成功后，res.tempFilePath是图片的临时文件路径  
									uni.saveImageToPhotosAlbum({
										filePath: res.tempFilePath,
										success: function(saveRes) {
											_this.$message.info('保存成功');
											console.log('保存图片成功，返回结果：', saveRes);
										},
										fail: function(err) {
											_this.$message.info('保存失败');
											console.log('保存图片失败，返回结果：', err);
										}
									});
								},
								fail: function(err) {
									console.log('下载图片失败，返回结果：', err);
								}
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					},
					fail: function(err) {
						console.log(err);
					}
				})
				// #endif
			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto;
	}

	.kefu_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.kefu_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: #333333;
		line-height: 50rpx;
	}

	.kefu_fd0_0_c0_c0 {
		font-size: 36rpx;
		color: #333;
	}

	.kefu_fd0_0_c0 {
		width: 120rpx;
	}

	.kefu_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.kefu_flex_1 {
		margin: 170rpx 0rpx 0rpx 0rpx;
	}

	.kefu_fd1_1_c0 {
		font-size: 28rpx;
		color: rgba(167, 166, 167, 1);
	}

	.kefu_fd1_0 {
		width: 500rpx;
		height: 500rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.kefu_fd2_0_c0 {
		color: var(--benbenFontColor3);
		font-size: 32rpx;
	}

	.kefu_fd2_0 {
		background: var(--benbenbgColor0);
		width: 690rpx;
		margin: 214rpx 30rpx 0rpx 30rpx;
		line-height: 88rpx;
		height: 88rpx;
		border-radius: 8rpx;
		background-size: 100% auto;
	}
</style>